Skip to content

feat(contracts): reproducible WASM builds with hash verification in CI - #1386

Merged
Calebux merged 1 commit into
Calebux:mainfrom
cyberdocs120:feat/1228-reproducible-wasm-builds
Sep 1, 2026
Merged

feat(contracts): reproducible WASM builds with hash verification in CI#1386
Calebux merged 1 commit into
Calebux:mainfrom
cyberdocs120:feat/1228-reproducible-wasm-builds

Conversation

@cyberdocs120

Copy link
Copy Markdown
Contributor

Summary

Implements #1228 — guardians can now independently verify that deployed WASM matches source.

Changes

contracts/rust-toolchain.toml (new)
Pins Rust 1.81.0 with wasm32-unknown-unknown target. Required by soroban-sdk v27 (confirmed from Cargo.lock). Rustup picks this up automatically in any subdirectory of contracts/.

.github/workflows/contracts.yml (rewritten)

  • All cargo build / cargo test calls now use --locked (Cargo.lock is authoritative)
  • Double-build determinism check: builds twice, wipes WASM output between passes, fails if any sha256 differs
  • Emits per-contract sha256 hashes to the Actions job summary (Markdown table)
  • Uploads wasm-contracts-<sha> and wasm-hashes-<sha> artifacts (90-day retention)
  • New publish-manifest job (tags only): generates and commits contracts/build-manifest.json
  • Fixed two pre-existing shell bugs in the contract-size check step

contracts/build-manifest.json (new placeholder)
Populated by CI on tagged releases. Maps each contract to sha256, commit, toolchain, and release tag.

contracts/scripts/build-reproducible.sh (new)
Single documented command for guardians:
bash
bash contracts/scripts/build-reproducible.sh # current tree
bash contracts/scripts/build-reproducible.sh v1.2.3 # specific tag
Auto-compares produced hashes against build-manifest.json when jq is available.

Acceptance criteria

  • rust-toolchain.toml pins the exact toolchain used for release builds
  • CI prints and uploads the sha256 of each contract WASM
  • Double-build determinism check runs on every contract PR and fails on mismatch
  • A guardian can reproduce the hash locally with a single documented command

Closes #1228

- Add contracts/rust-toolchain.toml pinning Rust 1.81.0 (required by
  soroban-sdk v27) with wasm32-unknown-unknown target and minimal profile

- Rewrite .github/workflows/contracts.yml:
  - Build with --locked on every cargo invocation (Cargo.lock is
    authoritative)
  - Double-build determinism check: build twice, wipe WASM output between
    passes, fail if any sha256 differs
  - Emit per-contract sha256 hashes to the GitHub Actions job summary as
    a Markdown table
  - Upload wasm-contracts-<sha> and wasm-hashes-<sha> artifacts (90-day
    retention) on every contract PR and push to main
  - Add publish-manifest job (tags only): generates and commits
    contracts/build-manifest.json with version, commit, toolchain, and
    per-contract sha256
  - Fix two pre-existing shell bugs in the contract-size check step

- Add contracts/build-manifest.json placeholder (populated by CI on
  tagged releases)

- Add contracts/scripts/build-reproducible.sh: single documented command
  for guardians to reproduce hashes locally and compare against the
  published manifest

Closes Calebux#1228
@cyberdocs120
cyberdocs120 requested a review from Calebux as a code owner August 31, 2026 13:59
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@cyberdocs120 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Calebux
Calebux merged commit c30ad96 into Calebux:main Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v2][contracts] Reproducible WASM builds with hash verification in CI

2 participants